<template>
  <div class="employees-container">
    <div class="app-container">
      <page-tools>
        <template #left>
          <span>总记录数: 16 条</span>
        </template>
        <template #right>
          <el-button type="warning" size="small">excel导入</el-button>
          <el-button type="danger" size="small">excel导出</el-button>
          <el-button type="primary" size="small">新增员工</el-button>
        </template>
      </page-tools>

      <el-card style="margin-top: 10px;">
        <el-table border :data="list">
          <el-table-column label="序号" type="index" />
          <el-table-column label="姓名" prop="username" />
          <el-table-column label="工号" prop="workNumber" />
          <el-table-column label="聘用形式" prop="formOfEmployment" />
          <el-table-column label="部门" prop="departmentName" />
          <el-table-column label="入职时间" prop="timeOfEntry" />
          <el-table-column label="操作" width="280">
            <template>
              <el-button type="text" size="small">查看</el-button>
              <el-button type="text" size="small">分配角色</el-button>
              <el-button type="text" size="small">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <el-row type="flex" justify="center" align="middle" style="height: 60px">
          <el-pagination layout="prev, pager, next" />
        </el-row>
      </el-card>
    </div>
  </div>
</template>
<script>
// 接口
import { getEmployeesInfo } from '@/api/employees'
export default {
  // 数据
  data() {
    return {
      // 1.数据 - 获取员工列表详情
      list: []
    }
  },
  // 钩子
  created() {
    // 1.获取员工列表详情
    this.loadEmployeesInfo()
  },
  // 方法
  methods: {
    // 1.获取员工列表详情
    async loadEmployeesInfo() {
      const res = await getEmployeesInfo({ page: 1, pagesize: 10 })
      console.log('员工管理详情', res)
      // 将数据绑定到data中
      this.list = res.data.rows
    }
  }
}
</script>
